import formBuilder from "@/comps/form/formBuilder";
import api from "./api";
import apiHouse from "@/pages/v1/pm/House/js/apiHouse";
import apiPayType from "@/pages/v1/pm/PayType/js/apiPayType";
/*
fb.addText("house","所属楼栋号",3)
fb.addText("name","费用标题",3)
fb.addText("startDate","开始日期",3)
fb.addText("endDate","结束日期",3)
fb.addText("amount","费用金额",3)
fb.addText("isPay","是否付款",3)
fb.addText("payAt","付款时间",3)
fb.addText("payType","付款方式",3)
fb.addText("note","备注",3)

* */
export default {
    main:function () {
        let fb = formBuilder()
        fb.setLabelWidth(100)

        fb.addSearch("houseId","所属楼栋号",12)
            .setApi(apiHouse.urlChoice).setApiSearchKeys(["name__regex"])
        fb.addText("name","费用标题",3)
        fb.addDateTime("startAt","开始日期",3).setDateTypeDate()
        fb.addDateTime("endAt","结束日期",3).setDateTypeDate()
        fb.addText("amount","费用金额",3).setTextTypeNumber()
        fb.addSwitch("isPay","是否付款",3)
        fb.addDateTime("payAt","付款时间",3)
        fb.addSelect("payTypeId","付款方式",3)
            .setApi(apiPayType.urlChoice)
        fb.addText("note","备注",12)
            .setTextMulti(true).setTextRows(3)
        return fb
    },
    tree:function () {
        let fb = formBuilder()
        fb.setLabelWidth(100)

        fb.addCascade("parentId").setLabel("上级分类").setSpan(3)
            .setApi(api.urlTree)

        fb.addText("name").setSpan(6).setLabel("分类名称")
            .setRules([fb.R.notNull("名称不能为空")])

        fb.addText("sort").setSpan(3).setLabel("排序").setTypeNumber()
        return fb
    },
    other:function () {
        let fb = formBuilder()
        fb.setLabelWidth(100).setLabelPosition("right")

        return fb
    }
}